<?php
include "Snoopy.class.php";
$snoopy = new Snoopy;
 
   if( isset($_GET['SNAPINURL']))
   {
      $strProto = substr($_GET['SNAPINURL'], 0, 4) ;
      $strURL = $_GET['SNAPINURL'] ;
   }
   elseif( isset($_GET['MODULE'])) 
   {
      $strProto = substr($_GET['MODULE'], 0, 4) ;
      $strURL = $_GET['MODULE'] ;
   }
   else
   {
      exit;
   }

   
   if( null != $strProto && strcasecmp($strProto, "http") == 0 )  //found http
   {
       print("//fetching unmodified...\n") ;       
   }
   else  //a URI like /2112PowerWindows/...
   {
      $strURL = "http://". $_SERVER["SERVER_NAME"]. $strURL ;
   }

   if(strlen($HTTP_SERVER_VARS ["PHP_AUTH_USER"]) > 0) 
   {
         $strURL = 
          str_replace ("http://", "http://". $HTTP_SERVER_VARS ["PHP_AUTH_USER"]. ":". $HTTP_SERVER_VARS ["PHP_AUTH_PW"]. "@"
                             , $strURL);
   }

   $snoopy->fetch($strURL);
   printf("//URL [%s]\n", $strURL) ;
   print ($snoopy->results);  
?>